package elitech.vietnam.myfashion.fragment;

import java.io.File;

import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import elitech.vietnam.myfashion.MainActivity;
import elitech.vietnam.myfashion.entites.Member;
import elitech.vietnam.myfashion.view.EditProfileView;
import elitech.vietnam.myfashion.view.MemberStyleView;

public class MemberStyleFragment extends Fragment {
	private MainActivity mContext;
	private Member mMember;
	
	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setRetainInstance(true);
		mContext = (MainActivity) getActivity();
	}

	public void setMember(Member member){
		this.mMember = member;
	}
	
	@Override
	public View onCreateView(LayoutInflater inflater, ViewGroup container,
			Bundle savedInstanceState) {
		if(mMember == null) return new View(mContext);
		return new MemberStyleView(mContext, mMember);
	}

	@Override
	public void onHiddenChanged(boolean hidden) {
		if(hidden)
		super.onHiddenChanged(hidden);
	}
	
	@Override
	public void onDestroy() {
		File file = new File(MainActivity.IMAGE_TEMP);
		if (file.exists())
			file.delete();
		super.onDestroy();
	}

}
